home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet multimedia / Animacje, filmy i prezentacje / Modelowanie 3D / K-3D 0.6.5.0 / k3d-all-in-one-setup-0.6.5.0.exe / k3d-setup-0.6.5.0.exe / share / shaders / k3d_rayserver.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-05-19  |  1.5 KB  |  52 lines

  1. /* rayserver.h - Shading Language (PRMan side) include file for ray server.
  2.  * 
  3.  * These macros translate calls to trace(), visibility(), and
  4.  * rayhittest() into calls to rayserver().  Each generates different
  5.  * numbers of args, allowing rayserver() to be pathmorphic.
  6.  *
  7.  * It is assumed that the rayserver() function itself is implemented
  8.  * as a DSO shadeop.  (See docs for PRMan 3.8 or later.)
  9.  *
  10.  * Note that the ray server expects its data in world space.
  11.  *
  12.  * Author: Larry Gritz (lg@bmrt.org)
  13.  *
  14.  * Reference:  
  15.  *   Gritz, Larry, "Ray Tracing in PRMan (with a little help from
  16.  *   BMRT)".  Appeared in: Apodaca and Gritz, eds., "Advanced
  17.  *   RenderMan: Beyond the Companion", SIGGRAPH '98 course notes
  18.  *   (Course #11), July 20, 1998.
  19.  */
  20.  
  21. #ifndef RAYSERVER_H
  22. #define RAYSERVER_H
  23.  
  24. #ifndef BMRT
  25.  
  26. /* PRMan side only -- BMRT already knows these functions */
  27.  
  28. #define worldp(p) transform("world",p)
  29. #define worldv(v) vtransform("world",v)
  30.  
  31. #define trace(p,d) rayserver(worldp(p), worldv(d))
  32.  
  33. #define visibility(from,to) rayserver(worldp(from), worldp(to))
  34.  
  35. #define rayhittest(p,d,phit,nhit) \
  36.         rayserver(worldp(p), worldv(d), phit,nhit)
  37.  
  38. #define fulltrace(p,d,chit,hitdist,phit,nhit,pmiss,rmiss) \
  39.         rayserver(worldp(p),worldv(d), chit,hitdist,phit,nhit,pmiss,rmiss)
  40.  
  41. #define areashadow(Ps,nsamples) rayserver(worldp(Ps), nsamples, __lightname)
  42.  
  43. #define rs_indirect(Ps,Ns) \
  44.         rayserver_indirect(worldp(Ps), normalize(worldv(Ns)))
  45.  
  46. float raylevel () { return 0; }
  47. float isshadowray () { return 0; }
  48.  
  49. #endif
  50.  
  51. #endif
  52.